let arr = [6, 9, 3, 4, 5];
let s = 0;
for (let i = arr.length - 1; i >= 0; i--) {
  if (arr[i] > arr[i - 1]) {
    s++;
  } else {
    break;
  }
}
let res = arr.length - 1 - s;
console.log(res);
